﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;


namespace ModelLayer.Login
{
    public class User
    {
        private static User instance;


        private Guid OID_;
        private string userName;
        private string passwordSalt;
        private string passwordSaltedHash;
        private DateTime lastLoginTime;
        private Guid staffOID;
        private Hashtable autorythyGroup;

        private string givenName;
        private string familyName;

        public User()
        {
            this.OID_ = new Guid();
            this.userName = null;
            this.passwordSalt = null;
            this.passwordSaltedHash = null;
            this.lastLoginTime = new DateTime();
            staffOID = new Guid();
            this.autorythyGroup = new Hashtable();
        }

        public static User Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new User();
                }
                return instance;
            }
        }


        public void setOid(Guid oid) { this.OID_ = oid; }
        public Guid getOid() { return this.OID_; }

        public void setName(string name) { this.userName = name; }
        public string getName() { return this.userName; }

        public void setSalt(string salt) { this.passwordSalt = salt; }
        public string getSalt() { return this.passwordSalt; }

        public void setPwdHash(string passHash) { this.passwordSaltedHash = passHash; }
        public string getPwdHash() { return this.passwordSaltedHash; }

        public void setLastDate(DateTime lastDate) { this.lastLoginTime = lastDate; }
        public DateTime getLastDate() { return this.lastLoginTime; }

        public void setStaffOID(Guid oid) { this.staffOID = oid; }
        public Guid getStaffOID() { return this.staffOID; }

        public void AddAutorithyGroup(Guid OID_AG, string responsability)
        {
            this.autorythyGroup.Add(OID_AG, responsability);
        }
        public Hashtable getAutorithyGroup() { return this.autorythyGroup; }

        public void Reset()
        {
            this.OID_ = new Guid();
            this.passwordSalt = "";
            this.passwordSaltedHash = "";
            this.givenName = "";
            this.familyName = "";
            this.userName = "";
            this.staffOID = new Guid();
            this.autorythyGroup = new Hashtable();

        }

        public void setGivenName(string gName) { this.givenName = gName; }
        public string getGivenName() { return this.givenName; }

        public void setFamilyName(string fName) { this.familyName = fName; }
        public string getFamilyName() { return this.familyName; }
    }
}
